"""Tree结构"""


class Tree:
    def __init__(self, code):
        self.code = code
        self.parent_id = None
        self.child_ids = []
        self.amount = 0

    def get_amount(self):
        """计算本节点的金额，等于所有下级节点的amount和"""

    def add_parent(self, node):
        """添加父级节点"""

    def add_child(self, node):
        """添加子级节点"""

    @classmethod
    def init_tree(cls, cr, sql_data):
        """用传入的sql_data初始化树"""
